USE DeltaFlex
GO
IF ( OBJECT_ID('dbo.sp_ActualitzarAlbara') IS NOT NULL ) 
   DROP PROCEDURE dbo.sp_ActualitzarAlbara
GO

CREATE PROCEDURE sp_ActualitzarAlbara
				@IDALBARA int,
				@IDORDRE int,
				@PEDIDOCLIENT varchar(100),
				@REFERENCIACLIENT varchar(100),
				@IDTREBALL varchar(100),
				@NUMTROQUEL varchar(50),
				@IDCLIENT int,
				@DATA date,
				@TOTAL decimal(8,4)
								
AS
BEGIN
	SET NOCOUNT ON

	 UPDATE dbo.ORDRE_TREBALL
	    SET IDCLIENT = @IDCLIENT,	
     		PEDIDOCLIENT = @PEDIDOCLIENT,
			REFERENCIACLIENT = @REFERENCIACLIENT,
			IDTREBALL = @IDTREBALL,
			NUMTROQUEL = @NUMTROQUEL
	  WHERE IDORDRE = @IDORDRE
			

	UPDATE dbo.ALBARA
	   SET IDCLIENT = @IDCLIENT,
		   DATA =@DATA,
		   TOTAL = @TOTAL
	 WHERE IDALBARA = @IDALBARA
	 
	END
GO

